package net.kazed.nextaction.task;

import net.kazed.nextaction.R;
import android.content.Context;
import android.view.LayoutInflater;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;

public class TaskContextListItemView extends LinearLayout {
   
	private TextView name;
	private Button deleteButton;

	public TaskContextListItemView(Context androidContext, int viewResourceId) {
		super(androidContext);
		
		LayoutInflater layoutInflater = (LayoutInflater) androidContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      layoutInflater.inflate(viewResourceId, this, true); 
        
		name = (TextView) findViewById(R.id.name);
		deleteButton = (Button) findViewById(R.id.task_content_delete_button);
	}

	/**
	 * Update view.
	 * @param context Display this context in view.
	 * @param isSelected
	 */
	public void updateView(final String contextPath, final OnClickListener deleteListener) {
      name.setText(contextPath);
      deleteButton.setOnClickListener(deleteListener);
   }

}
